#!/usr/bin/env python3
# main.py
import sys
import os

# 添加项目路径到Python路径
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, script_dir)

from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QIcon
from gui.cpu_scheduler_gui import CPUSchedulerGUI

# 从GUI类中获取版本号，避免重复定义
def main():
    app = QApplication(sys.argv)
    
    # 创建GUI实例以获取版本号
    gui_instance = CPUSchedulerGUI()
    version = gui_instance.get_package_version()
    
    # 设置应用程序信息
    app.setApplicationName("CPU频率调度器")
    app.setApplicationVersion(version)
    app.setOrganizationName("CPU Scheduler")
    
    # 创建主窗口
    main_window = gui_instance
    main_window.show()

    # 运行应用程序
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()